
package DataBase;

import edu.mit.jwi.IDictionary;
import edu.mit.jwi.item.*;
import java.util.*;
/**
 *
 * @author FY
 */
public class AdvSense extends Sense{
/*
 *     public ArrayList<Sense> getStemAjectives()          //return a list of StemAjectives
 *     public ArrayList<Sense> getAntonyms()               //return a list of Antonyms
 *     public ArrayList<Sense> getTopics()                 //return a list of Topics
 *     public ArrayList<Sense> getRegions()                //return a list of Regions
 *     public ArrayList<Sense> getUsages()                 //return a list of Usages

 *     public boolean hasAntonyms()                        //return a boolean var indicating whether the verb has such attribute
 *     public boolean hasStemAjectives()
 *     public boolean hasTopics()
 *     public boolean hasRegions()
 *     public boolean hasUsages()
*/

    public AdvSense(String Lemma,IDictionary dict_,POS PP,int Sense_cnt)
    {
	   super(Lemma,dict_,PP,Sense_cnt);
    }

    public AdvSense(IDictionary dict, ISynset synset) {
        super(dict, synset);
    }

    public AdvSense(IDictionary dict, IWord w) {
        super(dict, w);
    }

    public AdvSense(Sense s)
    {
        super(s.dict,s.synset);
    }


    public boolean hasAntonyms()
    {
        List < IWordID > anton = iwd.getRelatedWords (Pointer.ANTONYM );
        if (anton.isEmpty())
            return false;
        return true;
    }

    public ArrayList<Sense> getAntonyms()               //return a list of Antonyms
    {
           ArrayList<Sense> ant = new ArrayList<Sense>();
           List < IWordID > anton = iwd.getRelatedWords (Pointer.ANTONYM );
	   for( IWordID wid : anton )
	   {
                IWord word = dict . getWord ( wid );
		ant.add(new AdvSense(dict,word));
	   }
	   return ant;
    }

    public boolean hasStemAjectives()
    {
        List < IWordID > anton = iwd.getRelatedWords (Pointer.DERIVED_FROM_ADJ );
        if (anton.isEmpty())
            return false;
        return true;
    }

    public ArrayList<Sense> getStemAjectives()               //return a list of StemAjectives
    {
           ArrayList<Sense> ant = new ArrayList<Sense>();
           List < IWordID > anton = iwd.getRelatedWords (Pointer.DERIVED_FROM_ADJ);
	   for( IWordID wid : anton )
	   {
                IWord word = dict . getWord ( wid );
		ant.add(new AdvSense(dict,word));
	   }
	   return ant;
    }

    public boolean hasTopics()
    {
        List < IWordID > anton = iwd.getRelatedWords (Pointer.TOPIC );
        List < ISynsetID > ver = synset.getRelatedSynsets (Pointer.TOPIC);
        if (anton.isEmpty() && ver.isEmpty())
            return false;
        return true;
    }

    public ArrayList<Sense> getTopics()               //return a list of Topics
    {
           ArrayList<Sense> vg = new ArrayList<Sense>();
           List < ISynsetID > ver = synset.getRelatedSynsets (Pointer.TOPIC);
	   for( ISynsetID sid : ver )
	   {
		   vg.add(new AdvSense(dict,dict.getSynset(sid)));
	   }
           List < IWordID > der = iwd.getRelatedWords (Pointer.TOPIC);
	   for( IWordID wid : der )
	   {
                IWord word = dict . getWord ( wid );
		vg.add(new AdvSense(dict,word));
	   }
	   return vg;
    }

    public boolean hasRegions()
    {
        List < IWordID > anton = iwd.getRelatedWords (Pointer.REGION );
        List < ISynsetID > ver = synset.getRelatedSynsets (Pointer.REGION);
        if (anton.isEmpty() && ver.isEmpty())
            return false;
        return true;
    }


    public ArrayList<Sense> getRegions()               //return a list of Regions
    {
           ArrayList<Sense> vg = new ArrayList<Sense>();
           List < ISynsetID > ver = synset.getRelatedSynsets (Pointer.REGION);
	   for( ISynsetID sid : ver )
	   {
		   vg.add(new AdvSense(dict,dict.getSynset(sid)));
	   }
           List < IWordID > der = iwd.getRelatedWords (Pointer.REGION);
	   for( IWordID wid : der )
	   {
                IWord word = dict . getWord ( wid );
		vg.add(new AdvSense(dict,word));
	   }
	   return vg;
    }


    public boolean hasUsages()
    {
        List < IWordID > anton = iwd.getRelatedWords (Pointer.USAGE );
        List < ISynsetID > ver = synset.getRelatedSynsets (Pointer.USAGE);
        if (anton.isEmpty() && ver.isEmpty())
            return false;
        return true;
    }

    public ArrayList<Sense> getUsages()               //return a list of Usages
    {
           ArrayList<Sense> vg = new ArrayList<Sense>();
           List < ISynsetID > ver = synset.getRelatedSynsets (Pointer.USAGE);
	   for( ISynsetID sid : ver )
	   {
		   vg.add(new AdvSense(dict,dict.getSynset(sid)));
	   }
           List < IWordID > der = iwd.getRelatedWords (Pointer.USAGE);
	   for( IWordID wid : der )
	   {
                IWord word = dict . getWord ( wid );
		vg.add(new AdvSense(dict,word));
	   }
	   return vg;
    }
}
